﻿using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.SettingManagement;

namespace Volo.Abp.Extension.Web.Pages.SettingManagement.SiteSetting
{
    public class SiteSettingViewComponent : AbpViewComponent
    {
        private ISettingManager settingManager;

        public SiteSettingViewComponent(ISettingManager settingManager)
        {
            this.settingManager = settingManager;
        }


        public async Task<IViewComponentResult> InvokeAsync()
        {
            var model = new SiteSettingDto();

            model.SiteName = await this.settingManager.GetOrNullGlobalAsync(SiteSettingNames.SiteName);
            model.SiteDesc = await this.settingManager.GetOrNullGlobalAsync(SiteSettingNames.SiteDesc);

            return View("~/Pages/SettingManagement/SiteSetting/Default.cshtml", model);
        }
    }
}
